<?php
$this->breadcrumbs = array(
    'General Reports',
    'Report Penjualan Kartu',
);

$this->menu = array();

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
        $('.search-form').toggle();
        return false;
});
$('.search-form form').submit(function(){
        $.fn.yiiGridView.update('sys-serial-buyer-grid', {
                data: $(this).serialize()
        });
        return false;
});
");
?>
<div class="flat_area grid_16">
    <h2>Report Penjualan Kartu</h2>
</div>

<div class="box grid_16 round_all">
    <h2 class="box_head grad_colour round_all">Advanced Search</h2>
    <a href="#" class="grabber">&nbsp;</a>
    <a href="#" class="toggle toggle_closed">&nbsp;</a>
    <div class="toggle_container" style="display:none;">
<div class="search-form">
<div class="form">
        <?php
        
        $this->renderPartial('_search', array(
//            'model_member' => $model_member,
//            'model_serial' => $model_serial,
//            'model_serial_products' => $model_serial_products,
//            'model_network' => $model_network,
            'model_serial_buyer' => $model_serial_buyer,
        ));
        ?>
</div>
</div>
</div>
</div
<!-- search-form -->
<?php

$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'sys-serial-buyer-grid',
    'dataProvider' => $model_serial_buyer->search_serial_report(),
    'filter' => $model_serial_buyer,
    'columns' => array(
        array(
            'header' => 'No.',
            'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)."."',
            'htmlOptions' => array('style' => 'text-align:center;'),
        ),
        array(
            'header'=>'Tanggal',
            'name'=>'serial_buyer_datetime',
            //'filter'=>'',
            'value'=>'Yii::app()->dateFormatter->formatDateTime($data->serial_buyer_datetime,"medium")',
        ),
        array(
            'header'=>'Member Id',
            'name'=>'network_mid',
            'value'=>'$data->rel_buyer_to_network->network_mid',
        ),
        array(
            'header'=>'Nama Member',
            'name'=>'member_name',
            'value'=>'$data->rel_buyer_to_network->rel_network_to_member->member_name',
        ),
        
        array(
            'header'=>'Pasif',
            'name'=>'count_pasive',
            'value'=>'$data->count_pasive',
        ),
        array(
            'header'=>'Aktif',
            'name'=>'count_active',
            'value'=>'$data->count_active',
        ),
       
        array(
            'header'=>'Total',
            //'name'=>'network_mid',
            'value'=>'($data->count_pasive+$data->count_active)',
            //'footer'=>'',
        ),
    ),
    //'selectableRows' => 0,
    //'selectionChanged' => 'userClicks',
    'pager' => array(
        'cssFile' => Yii::app()->params['backendUrl'] . '/css/style-pager.css',
        'header' => '',
        'firstPageLabel' => 'First',
        'prevPageLabel' => 'Previous',
        'nextPageLabel' => 'Next',
        'lastPageLabel' => 'Last',
    ),
    'cssFile' => Yii::app()->params['backendUrl'] . '/css/style-gridview.css',
    'loadingCssClass' => '',
));
?>
<div style="border-top:1px solid silver; border-bottom:1px solid silver; background: #EEEEEE; padding:10px;">
<?php
$xls_icon=Yii::app()->baseUrl.'/images/report_icon/excel.png';
echo CHtml::form('', 'POST');
echo CHtml::imageButton($xls_icon,array('alt'=>'Excel','title'=>'Download in Excel','name'=>'button[xls]','value'=>'xls'));
echo CHtml::endForm();
?>
</div>
